home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBASE102.ARJ / CBASE_.H < prev    next >
Text File  |  1991-09-23  |  3KB  |  93 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "@(#)cbase_.h    1.5 - 91/09/23" */
  5.  
  6. /*man---------------------------------------------------------------------------
  7. NAME
  8.      cbase_.h - private header file for cbase library
  9.  
  10. SYNOPSIS
  11.      #include "cbase_.h"
  12.  
  13. DESCRIPTION
  14.      This is a private header file included by the cbase library
  15.      modules.
  16.  
  17. ------------------------------------------------------------------------------*/
  18. #ifndef H_CBASE_    /* prevent multiple includes */
  19. #define H_CBASE_
  20.  
  21. #include <ansi.h>
  22.  
  23. /*#define DEBUG        /* switch to enable debugging for cbase library */
  24.  
  25. /* ansi headers */
  26. #include <stdio.h>
  27.  
  28. /* non-ansi headers */
  29. #include <bool.h>
  30.  
  31. /* local headers */
  32. #include "cbase.h"
  33.  
  34. /* constants */
  35. #define CBTYPECNT    ((size_t)27)
  36. #define EXPFLDDLM    ('|')        /* export field delimiter */
  37. #define EXPRECDLM    ('\n')        /* export record delimiter */
  38. #define EXPESC        ('\\')        /* export field escape character */
  39. #define CB_READ        ("r")        /* cbase open types */
  40. #define CB_RDWR        ("r+")
  41.  
  42. /* tables */
  43. #ifdef AC_PROTO
  44. extern cbase_t cbb[CBOPEN_MAX];    /* cbase control structure table declaration */
  45. typedef int (*cbcmp_t)(const void *p1, const void *p2, size_t n);
  46. extern const cbcmp_t cbcmpv[CBTYPECNT];    /* comparison function table decl. */
  47. typedef int (*cbexp_t)(FILE *fp, const void *p, size_t n);
  48. extern const cbexp_t cbexpv[CBTYPECNT];    /* export function table decl. */
  49. typedef int (*cbimp_t)(FILE *fp, void *p, size_t n);
  50. extern const cbimp_t cbimpv[CBTYPECNT];    /* import function table decl. */
  51. #else
  52. extern cbase_t cbb[CBOPEN_MAX];    /* cbase control structure table declaration */
  53. typedef int (*cbcmp_t)();
  54. extern cbcmp_t cbcmpv[CBTYPECNT];    /* comparison function table decl. */
  55. typedef int (*cbexp_t)();
  56. extern cbexp_t cbexpv[CBTYPECNT];    /* export function table decl. */
  57. typedef int (*cbimp_t)();
  58. extern cbimp_t cbimpv[CBTYPECNT];    /* import function table decl. */
  59. #endif    /* #ifdef AC_PROTO */
  60.  
  61. /* cbase_t bit flags */
  62. #define CBOPEN          (03)    /* open status bits */
  63. #define CBREAD          (01)    /* cbase is open for reading */
  64. #define CBWRITE          (02)    /* cbase is open for writing */
  65. #define CBLOCKS         (030)    /* lock status bits */
  66. #define CBRDLCK         (010)    /* cbase is read locked */
  67. #define CBWRLCK         (020)    /* cbase is write locked */
  68. #define CBERR        (0100)    /* error has occurred on this cbase */
  69.  
  70. /* function declarations */
  71. #ifdef AC_PROTO
  72. int    cb_alloc(cbase_t *cbp);
  73. void    cb_freemem(cbase_t *cbp);
  74. bool    cb_fvalid(size_t recsize, int fldc, const cbfield_t fldv[]);
  75. bool    cb_valid(cbase_t *cbp);
  76. #else
  77. int    cb_alloc();
  78. void    cb_freemem();
  79. bool    cb_fvalid();
  80. bool    cb_valid();
  81. #endif    /* #ifdef AC_PROTO */
  82.  
  83. #ifdef DEBUG
  84. #define    CBEPRINT {                            \
  85.     fprintf(stderr, "*** cbase error line %d of %s. errno = %d.\n",    \
  86.         __LINE__, __FILE__, errno);                \
  87. }
  88. #else
  89. #define CBEPRINT
  90. #endif
  91.  
  92. #endif        /* #ifndef H_CBASE_ */
  93.